package com.dunshan.prcexp.testjava;

import com.alibaba.fastjson.JSONObject;
import com.dunshan.prcexp.config.IAction;
import com.dunshan.prcexp.pojo.HttpEntity;
import org.testng.annotations.DataProvider;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author liwen406
 * @program: dunshan-pef
 * @description:
 * @date 2022-08-24 17:35:55
 */
public class DataNumberProvider {

    @DataProvider
    public Object[][] getStarted01() {
        HashMap<String, String> header = new HashMap<>();

        JSONObject body = new JSONObject();
        body.put("area", "184549376_187170816_187170818");
        body.put("channelType", 1);
        body.put("language", "en_US");
        body.put("platform", "2");
        body.put("shopId", "16501");
        body.put("site", 1);
        HashMap<String, String> bodiesMap = new HashMap<>();
        bodiesMap.put("body", JSONObject.toJSONString(body));
        Object[][] result = new Object[1][];
        int k = 0;
        for (int j = 0; j < 1; j++) {
            List<HttpEntity> httpEntityList = new ArrayList<>();
            HttpEntity productSearchBeta = new HttpEntity.Builder()
                    .url("functionId=skuDyInfo")
                    .queryParams(parameterMap())
                    .headers(header)
                    .ip("202.77.132.231")
                    .method(IAction.Http.POST)
                    .formBodies(bodiesMap)
                    .build();

            HttpEntity productSearchApi = new HttpEntity.Builder()
                    .url("functionId=skuDyInfo")
                    .queryParams(parameterMap())
                    .headers(header)
                    .method(IAction.Http.POST)
                    .formBodies(bodiesMap)
                    .build();

            httpEntityList.add(productSearchBeta);
            httpEntityList.add(productSearchApi);

            result[k++] = new Object[]{httpEntityList};
        }

        return result;
    }

    /**
     * 请求信息
     *
     * @return
     */
    public static Map<String, String> parameterMap() {
        Map<String, String> queriesMap = new HashMap<>(1);
        queriesMap.put("clientVersion", "2.41.1");
        queriesMap.put("build", "12454");
        queriesMap.put("client", "android");
        queriesMap.put("d_brand", "Xiaomi");
        queriesMap.put("d_model", "MI6Plus");
        queriesMap.put("osVersion", "6.0.1");
        queriesMap.put("screen", "1108*1869");
        queriesMap.put("partner", "jingdong");
        queriesMap.put("androidId", "a5f05c526f9759c4");
        queriesMap.put("installtionId", "eb68dba66618444a936040e0d9192d48");
        queriesMap.put("sdkVersion", "23");
        queriesMap.put("uuid", "a5f05c526f9759c4");
        queriesMap.put("area", "184549376_184877056_184877058_0");
        queriesMap.put("lang", "en_US");
        queriesMap.put("country", "MY");
        queriesMap.put("eid", "eidAe845812280scbEpJJJoLRXe1zWaFlRq0l2xKSp6Nvo0V8NO7BNS7uMlH6Gi NagxC2domWIAsbReHwsX1tznIyMMIKhu7/MKg47gFd2gAv lxtln");
        queriesMap.put("networkType", "wifi");
        queriesMap.put("st", "1653966300142");
        queriesMap.put("sign", "599bea5faed3c2a599146319338c6dc1");
        queriesMap.put("sv", "120");
        return queriesMap;
    }


}
